<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ page session="true" %>
<script type="text/javascript">
$(document).ready(function(){
	$("#searchZipcode").click(function (e){
		var dong = $("#dong").val();
		if(!dong){
			alert("지역명을 입력해주세요.");
			$("#dong").focus();
			return;
		}else{
			location.href="zipcode.vh?dong="+dong;
		}
	});
});

selectZipcode = function(zip1,zip2,sido,gugun,dong){
	var receiveListSet  = eval('(' + '[]' + ')');
	var receiveList = $.cookies.get('receiveList');
	if(receiveListSet){
		receiveListSet.push({
	    	receive_name: receiveList[0].receive_name
	    	, receive_cell: receiveList[0].receive_cell
	    	, receive_zipcode1: zip1
	    	, receive_zipcode2: zip2
	    	, receive_address1: sido+' '+gugun+' '+dong
	    	, receive_address2: receiveList[0].receive_address2
	    	, receive_memo: receiveList[0].receive_memo
	    	, buyer_name: receiveList[0].buyer_name
	    	, buyer_cell: receiveList[0].buyer_cell
	    	, receive_memo: receiveList[0].receive_memo
	    }); 
	}else{
		receiveListSet.push({
	    	receive_name: ''
	    	, receive_cell: ''
	    	, receive_zipcode1: zip1
	    	, receive_zipcode2: zip2
	    	, receive_address1: sido+' '+gugun+' '+dong
	    	, receive_address2: ''
	    	, receive_memo: ''
	    	, buyer_name: ''
	    	, buyer_cell: ''
	    	, receive_memo: ''
	    }); 
	}
    $.cookies.set('receiveList', receiveListSet); 
    
    location.href="/vhmall/order.vh";
}

</script>
<!-- 콘텐츠 영역 -->
    <div id="BodyWrap">
        <section>
            <h4 class="pag_title" title="주소검색">주소검색</h4>
            <div id="ContentWrap4">
            	<div class="adsearch_bd">
                	<div class="addr_maintx">찾고자 하시는 주소의 동(읍/면)/도로명을 입력하세요.</div>
                    <div class="addr_sear">
                    	<div class="addr_f1">지역명</div>
                        <div class="addr_f2"><a href="javascript:;" class="btninli_blk" title="검색" id="searchZipcode"><span class="btn_ins">검색</span></a></div>
                        <div class="addr_inpbox">
                        
                        	<p>
                            	<input name="dong" id="dong" type="text" maxlength="20">
                            </p>
                        	<!-- <a href="#" class="btn_delsi1" title="삭제">×</a> -->
                        
                        </div>
                    </div>
                    <div class="addrstw">예)청담1동, 한강로 3가, 수지읍</div>
                </div>
				<div class="adsearch_bd">
                	<div class="addr_maintx ta_l">아래의 목록에서 해당 되는 주소를 선택해주세요.</div>
                    <ul class="addr_selectlist">
                    <c:forEach items="${requestScope.zipcodeList}" var="items" varStatus="status">
                    	<li>
                        	<a href="javascript:;" onclick="selectZipcode('${items.ZIPCODE1}','${items.ZIPCODE2}','${items.SIDO}','${items.GUGUN}','${items.DONG}');">
                            	<ol>
                                    <li><!-- 
                                    	<div class="f_l box_udos2">
                                        	<span class="gradation_darkgray2">지번</span>
                                        </div>
                                        <div class="addrsph">서울특별시 강남구 영동대로 415 (대치동)</div>
                                         -->
                                        [${items.ZIPCODE1}-${items.ZIPCODE2}] ${items.SIDO} ${items.GUGUN} ${items.DONG} ${items.BUNJI}
                                    </li>
                                </ol>
                            </a>
                        </li>
                    </c:forEach>
                        <!-- 
                        <li>
                        	<a href="#">
                            	<ol>
                                	<li>
                                    	<div class="f_l box_udos1">
                                        	<span class="gradation_red3">도로명</span>
                                        </div>
                                        <div class="addrsph">서울특별시 강남구 영동대로 415 (대치동)</div>
                                    </li>
                                    <li>
                                    	<div class="f_l box_udos2">
                                        	<span class="gradation_darkgray2">지번</span>
                                        </div>
                                        <div class="addrsph">서울특별시 강남구 대치2동 1002 KT&amp;G타워</div>
                                    </li>
                                </ol>
                            </a>
                        </li>
                        <li>
                        	<a href="#">
                            	<ol>
                                	<li>
                                    	<div class="f_l box_udos1">
                                        	<span class="gradation_red3">도로명</span>
                                        </div>
                                        <div class="addrsph">서울특별시 강남구 영동대로 415 (대치동)</div>
                                    </li>
                                    <li>
                                    	<div class="f_l box_udos2">
                                        	<span class="gradation_darkgray2">지번</span>
                                        </div>
                                        <div class="addrsph">서울특별시 강남구 대치2동 1002 KT&amp;G타워</div>
                                    </li>
                                </ol>
                            </a>
                        </li>
                        <li>
                        	<a href="#">
                            	<ol>
                                	<li>
                                    	<div class="f_l box_udos1">
                                        	<span class="gradation_red3">도로명</span>
                                        </div>
                                        <div class="addrsph">서울특별시 강남구 영동대로 415 (대치동)</div>
                                    </li>
                                    <li>
                                    	<div class="f_l box_udos2">
                                        	<span class="gradation_darkgray2">지번</span>
                                        </div>
                                        <div class="addrsph">서울특별시 강남구 대치2동 1002 KT&amp;G타워</div>
                                    </li>
                                </ol>
                            </a>
                        </li>
                         -->
                    </ul>
                </div>
            </div>
        </section>
        <!--// 콘텐츠 영역 -->